# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gobject-introspection
pkgver=1.80.1
pkgrel=2
pkgdesc="Introspection system for GObject-based libraries"
url="https://wiki.gnome.org/action/show/Projects/GObjectIntrospection"
arch="all"
license="LGPL-2.0-or-later AND GPL-2.0-or-later AND MIT"
depends_dev="
	cairo-dev
	libtool
	py3-setuptools
	python3
	"
makedepends="$depends_dev
	bison
	flex
	glib-dev
	libffi-dev
	meson
	python3-dev
	"
subpackages="$pkgname-doc $pkgname-dev"
replaces="libgirepository"
checkdepends="sed"
source="https://download.gnome.org/sources/gobject-introspection/${pkgver%.*}/gobject-introspection-$pkgver.tar.xz"

case "$CARCH" in
*)
	# FIXME: the gir scan on
	#define REGRESS_GOOD_EXPR_CONSTANT (1 + 2 * (3 + 2) << 3 - 4 >> REGRESS_ATEST_ERROR_CODE2)
	# evaluates to 0 instead of -2305843009213693952
	# so a test failes
	# https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/458
	options="$options !check"
	;;
esac

build() {
	abuild-meson -Db_lto=true . output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

dev() {
	amove usr/bin usr/share usr/lib/gobject-introspection
	default_dev
	replaces="gobject-introspection"
}

sha512sums="
f45c2c1b105086488d974c6134db9910746df8edb187772f2ecd249656a1047c8ac88ba51f5bf7393c3d99c3ace143ecd09be256c2f4d0ceee110c9ad51a839a  gobject-introspection-1.80.1.tar.xz
"
